package com.kqb.sgpicturebackend.model.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @author 杉果树皮
 * @date 2025/4/26 18:46
 * @description:
 */
@Getter
public enum ReviewStatusEnum {

    REVIEWING("待审核", 0),

    PASS("通过", 1),

    REJECT("拒绝", 2);


    ReviewStatusEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }


    private final String text;
    private final Integer value;

    /**
     * 根据value获取枚举
     *
     * @param value
     * @return
     */
    public static ReviewStatusEnum getEnumByValue(Integer value) {
        if (ObjectUtil.isEmpty(value)) {
            return null;
        }
        for (ReviewStatusEnum anEnum : ReviewStatusEnum.values()) {
            if (Objects.equals(anEnum.value, value)) {
                return anEnum;
            }
        }
        return null;
    }
}
